import axios from "axios";

// import { BASE_URL, TIMEOUT } from "./config";
const instance = axios.create({
  baseURL: "http://116.205.131.0:8889/api",
  timeout: 10000,
  headers: {
    "Content-Type": "multipart/form-data",
  },
});

instance.interceptors.request.use(
  (config) => {
    // 在请求发送之前进行操作，例如添加 token 等
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);

instance.interceptors.response.use(
  (response) => {
    // 对响应数据进行操作，例如统一处理错误码等
    return response.data;
  },
  (error) => {
    return Promise.reject(error);
  }
);

export default instance;
